home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2007 December / PCWKCD1207B.iso / Blogowanie poza sfera / Flock 0.9.1.3 stable / flock-0.9.1.3.en-US.win32.exe / flock / chrome / browser.jar / content / browser / bookmarks / selectBookmark.js < prev    next >
Text File  |  2006-08-23  |  2KB  |  73 lines

  1. //@line 38 "/cygdrive/K/tinderbuild/src/flock/mozilla/browser/components/bookmarks/content/selectBookmark.js"
  2.  
  3. var gBookmarkTree;
  4. var gOK;
  5. var gUrls;
  6. var gNames;
  7.  
  8. function Startup()
  9. {
  10.   initServices();
  11.   initBMService();
  12.   gOK = document.documentElement.getButton("accept");
  13.   gBookmarkTree = document.getElementById("bookmarks-view");  
  14.   gBookmarkTree.treeBoxObject.view.selection.select(0);
  15.   gBookmarkTree.focus();
  16. }
  17.  
  18. function onDblClick()
  19. {
  20.   if (!gOK.disabled)
  21.     document.documentElement.acceptDialog();
  22. }
  23.  
  24. function updateOK()
  25. {
  26.   var selection = gBookmarkTree._selection;
  27.   var ds = gBookmarkTree.tree.database;
  28.   var url, name;
  29.   gUrls = [];
  30.   gNames = [];
  31.   for (var i=0; i<selection.length; ++i) {
  32.     var type     = selection.type[i];
  33. // XXX protocol is broken since we have unique id...
  34. //    var protocol = selection.protocol[i];
  35. //    if ((type == "Bookmark" || type == "") && 
  36. //        protocol != "find" && protocol != "javascript") {
  37.     if (type == "Bookmark" || type == "") {
  38.       url = BookmarksUtils.getProperty(selection.item[i], gNC_NS+"URL", ds);
  39.       name = BookmarksUtils.getProperty(selection.item[i], gNC_NS+"Name", name);
  40.       if (url && name) {
  41.         gUrls.push(url);
  42.         gNames.push(name);
  43.       }
  44.     } else if (type == "Folder" || type == "PersonalToolbarFolder") {
  45.       RDFC.Init(ds, selection.item[i]);
  46.       var children = RDFC.GetElements();
  47.       while (children.hasMoreElements()) {
  48.         var child = children.getNext().QueryInterface(kRDFRSCIID);
  49.         type      = BookmarksUtils.getProperty(child, gRDF_NS+"type", ds);
  50. // XXX protocol is broken since we have unique id...
  51. //        protocol  = child.Value.split(":")[0];
  52. //        if (type == gNC_NS+"Bookmark" && protocol != "find" && 
  53. //            protocol != "javascript") {
  54.           if (type == gNC_NS+"Bookmark") {
  55.           url = BookmarksUtils.getProperty(child, gNC_NS+"URL", ds);
  56.           name = BookmarksUtils.getProperty(child, gNC_NS+"Name", ds);
  57.           if (url && name) {
  58.             gUrls.push(url);
  59.             gNames.push(name);
  60.           }
  61.         }
  62.       }
  63.     }
  64.   }
  65.   gOK.disabled = gUrls.length == 0;
  66. }
  67.  
  68. function onOK(aEvent)
  69. {
  70.   window.arguments[0].urls = gUrls;
  71.   window.arguments[0].names = gNames;
  72. }
  73.